#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
string s;
LL ans;
int main()
{
	cin >> s;
	//124
	for (int i = 0; i < s.size() - 1; i++) {
		int k = (s[i] - '0') * 10 + (s[i + 1] - '0');
		//cout << "k==" << k << endl;
		if (k % 4 == 0)ans += i + 1;
		if ((s[i] - '0') % 4 == 0)ans++;
	}
	if ((s[s.size() - 1] - '0') % 4 == 0)ans++;
	cout << ans << endl;
}